<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Template {

    public $template_path = 'templates/';
    public $template_data = array();

    public function set($name, $value) {
        $this->template_data[$name] = $value;
    }

    public function widget($widget, $path) {
        $this->CI = & get_instance();
        $this->set($widget, $this->CI->load->view($path . $widget, $this->template_data, TRUE));
    }

    function load($template, $view_data = array(), $return = FALSE) {
        $this->CI = & get_instance();
        $this->set('head', $this->CI->load->view('meta/' . $template, $this->template_data, TRUE));
        $this->set('scripts', $this->CI->load->view('scripts/' . $template, $this->template_data, TRUE));
        $this->set('header', $this->CI->load->view('includes/header', $this->template_data, TRUE));
        $this->set('footer', $this->CI->load->view('includes/footer', $this->template_data, TRUE));
        return $this->CI->load->view($this->template_path . $template, $this->template_data, $return);
    }

}

/* End of file Template.php */
    /* Location: ./system/application/libraries/Template.php */